# include <cstdlib>
# include <iostream>
# include <iomanip>
# include <ctime>

using namespace std;

# include "mpi.h"

int main ( int argc, char *argv[] );
void timestamp ( );



int main ( int argc, char *argv[] )


{
  int id;
  int p;
  double wtime;
//
//  Initialize MPI.
//
  MPI::Init ( argc, argv );
//
//  Get the number of processes.
//
  p = MPI::COMM_WORLD.Get_size ( );
//
//  Get the individual process ID.
//
  id = MPI::COMM_WORLD.Get_rank ( );
//
//  Process 0 prints an introductory message.
//
  if ( id == 0 )
  {
    cout << "\n";
    cout << "HELLO_MPI - Master process:\n";
    cout << "  C++/MPI version\n";
    cout << "  An MPI example program.\n";
    cout << "\n";
    cout << "  The number of processes is " << p << "\n";
    cout << "\n";
  }
//
//  Every process prints a hello.
//
  if ( id == 0 )
  {
    wtime = MPI::Wtime ( );
  }
  cout << "  Process " << id << " says 'Hello, world!'\n";
//
//  Process 0 says goodbye.
//
  if ( id == 0 )
  {
    wtime = MPI::Wtime ( ) - wtime;
    cout << "  Elapsed wall clock time = " << wtime << " seconds.\n";
  }

  MPI::Finalize ( );

  if ( id == 0 )
  {
    cout << "\n";
    cout << "HELLO_MPI:\n";
    cout << "  Normal end of execution.\n";
    cout << "\n";

  }
  return 0;
